package com.tecent.chat.utils;

import android.util.Log;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

public class HttpUtils {
    public static String sendUrl(String url1) {
        StringBuffer sb = new StringBuffer();
        try {
            URL url = new URL(url1);
            HttpURLConnection conn = (HttpURLConnection)url.openConnection();
            conn.setReadTimeout(5000);
            conn.setRequestMethod("GET");

            InputStream inputStream = conn.getInputStream();
            BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));

            String str = null;

            while((str = br.readLine()) != null){
                sb.append(str);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return sb.toString();
    }
}
